﻿Imports SdlDotNet.Graphics
Imports SdlDotNet.Graphics.Sprites
Imports System.Drawing

Public Class Cursor
    Private Shared _instance As Cursor

    Public Position As New Point(0, 0)
    Private _status As PointerType = PointerType.Standard
    Public Property Status() As PointerType
        Get
            Return _status
        End Get
        Set(ByVal value As PointerType)
            If (_status <> value) Then
                If (value = PointerType.Standard) Then
                    CursorSprite.Surface = StandardPointerSurface
                ElseIf (value = PointerType.Target) Then
                    CursorSprite.Surface = TargetPointerSurface
                End If
            End If
            _status = value
        End Set
    End Property

    Private CursorSprite As Sprite
    Private StandardPointerSurface As New Surface("Resources\images\cursors\Standard.png")
    Private TargetPointerSurface As New Surface("Resources\images\cursors\Target.png")

    Protected Sub New()
        CursorSprite = New Sprite(StandardPointerSurface)
    End Sub

    Public Sub Draw(ByRef display As Surface)
        display.Blit(CursorSprite, Position)
    End Sub

    Public Shared Function Instance() As Cursor
        If _instance Is Nothing Then
            _instance = New Cursor()
        End If
        Return _instance
    End Function

    Public Enum PointerType
        Standard = 0
        Target = 1
    End Enum
End Class
